package org.bluweb.g4wicket.chrome;

import org.apache.wicket.markup.html.IHeaderResponse;
import org.bluweb.g4wicket.G4WicketBehaviour;

@SuppressWarnings("serial")
public class ChromeFrameInstall extends G4WicketBehaviour {

//	private boolean chromeFrame;
	
//	@Override
//	public void bind(Component component) {
//
//		ServletWebRequest webRequest = (ServletWebRequest) component.getPage().getRequestCycle().getRequest();
//		this.chromeFrame = webRequest.getHttpServletRequest().getHeader( "User-Agent" ).contains( "chromeframe" );
//	}
	
	@Override
	public void renderHead( IHeaderResponse response ) {

		response.renderString( "<!--[if IE]>" );
		response.renderJavascriptReference( "http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js" );
		response.renderString( this.getCSS( "ChromeFrameInstall.css" ) );
		
		response.renderJavascript( this.getJavaScript( "ChromeFrameInstall.js", null ), "cfi" );
		response.renderString( "<![endif]-->" );
	}
}
